#include "ExchangeVector3.h"

#include "Constants.h"

ExchangeVector3::ExchangeVector3(Layer mag,Layer pol)
{
  double J;
  x=0;y=0;z=0;

  if(mag.getNumber()-pol.getNumber()==1)
    {   
      J=mag.getUpExchange();  
      x+=J/(mag.getMs()*Constants::MU0)*pol.getMag().getX();
      y+=J/(mag.getMs()*Constants::MU0)*pol.getMag().getY();
      z+=J/(mag.getMs()*Constants::MU0)*pol.getMag().getZ();
    }
  if(mag.getNumber()-pol.getNumber()==-1)
    {   
      J=mag.getDownExchange();
      x+=J/(mag.getMs()*Constants::MU0)*pol.getMag().getX();
      y+=J/(mag.getMs()*Constants::MU0)*pol.getMag().getY();
      z+=J/(mag.getMs()*Constants::MU0)*pol.getMag().getZ();
    }
}

ExchangeVector3::~ExchangeVector3()
{

}
